/**
 * This program is free software but WITHOUT ANY WARRANTY OR CONDITIONS OF ANY KIND.
 *
 * Copyright (C) 2008 www.pretty-tools.com
 */

function onLoad()
{
    try
    {
        if (typeof external.menuArguments == 'undefined')
            wsshWindowManager.openSlideShow([window.arguments[0]], window.arguments[1], window);
        else
        {
            var wnd = external.menuArguments;

            var doc = wnd.document;
            var image = wnd.event.srcElement;

            var helper = yrprxComponentsFactory.createInstance("XPCOMAdapter.ContextMenuHelper.1");

            var url = g_wsshImageResolver.getImageURL(doc, image, helper.GetDocumentLocation(doc));
            if (!url) url = image.src;
            // show image fullscreen
            wsshWindowManager.openSlideShow([url], doc.title);
        }
    }
    catch(ex)
    {
        try
        {
            var logger = yrprxFactory.createLogger("context-menu-fullscreen.js");
            if (logger.enabled) logger.error("onViewFullScreen: ", ex);
        }
        catch(ex2)
        {
            dump("Cannot create logger! Exception: " + ex.message + "\n");
        }

        if (typeof external.menuArguments == 'undefined')
            yrprxBrowser.closeWindow();
    }
}
